package com.tongtong.middleware.blockchain.client.bsn;

import feign.Feign;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

@Configuration
@RefreshScope
public class BSNConfig {
	@Value("${bsn.gateway}")
	private String gateway;
	@Getter
	@Value("${bsn.apiToken}")
	private String apiToken;
	
	BSNClient bsnClient = null;

	/**
	 * 创建链接
	 */
	public BSNClient conn() {
		if (bsnClient == null) {
			bsnClient = Feign.builder().target(BSNClient.class, gateway);
		}
		return bsnClient;
	}

}
